package BLC

type BlockChain struct{
	Blocks []*Block
}

//创建一个带有创世纪区块的数组
func NewBlockChain()*BlockChain{
	return &BlockChain{[]*Block{NewGenisBlock()}}
}

func (bc *BlockChain)AddBlock(data string){
	preBlock:=bc.Blocks[len(bc.Blocks)-1]
	newBlock:=NewBlock(data,preBlock.Hash)
	bc.Blocks=append(bc.Blocks,newBlock)
}